home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-07 | 2.6 KB | 90 lines | [TEXT/MPCC] |
- // ----------------------------------------------------------------------------------
- // ErrMsg.c
- // ----------------------------------------------------------------------------------
- // Deals with errors. Right now it merely puts up an alert box with the error.
- //
- // ----------------------------------------------------------------------------------
- // History:
- // 9/26/94 Clark Goble Original (based on a project by Brigham Stevens)
- //
-
- #define KEEP_GOING 1
- #define DEBUGGER 2
- #define EXITTOSHELL 3
-
-
- void Msg(Str255 msg);
- void ErrMsgCode(Str255 msg, short code);
- void ErrMsg(Str255 msg);
-
-
- // ----------------------------------------------------------------------------------
- // Msg
- // ----------------------------------------------------------------------------------
- // Displays a message in an alert box. This is a different alert window than that
- // used for errors.
-
- void Msg(Str255 msg)
- {
- ParamText(msg,nil,nil,nil);
- Alert(130, nil);
- } // Msg
-
- // ----------------------------------------------------------------------------------
- // ErrMsgCode
- // ----------------------------------------------------------------------------------
- // Displays the error alert with an error code. This will also display memerr and
- // reserr for you.
- //
- // This demo is copywrite 1994 by LexTek Internation. Feel free to use it for
- // whatever purpose you wish. The SpellWright Library may not be copied or
- // distributed, except when linked to your application that adds significant features
- // to the code. ie. you can't take the library, make a new library and sell it. You
- // can, however, use it without royalties in applications or other such projects.
- //
- // LexTek International
- // 2255 N. University Parkway, Suit 15
- // Provo, UT 84604
- // (801) 375.8332 Phone
- // (801) 375.7654 Fax
-
- void ErrMsgCode(Str255 msg, short code)
- {
- Str31 codeStr;
- Str31 memErrStr;
- Str31 resErrStr;
- short disposition;
-
- NumToString(code,codeStr);
- NumToString(LMGetMemErr(),memErrStr);
- NumToString(LMGetResErr(),resErrStr);
-
- ParamText(msg, codeStr, memErrStr, resErrStr);
-
- disposition = Alert(128, nil);
-
- switch(disposition)
- {
- case KEEP_GOING: return;
- break;
- case DEBUGGER: DebugStr("\p Doing a Stack Crawl;sc6");
- break;
- case EXITTOSHELL: ExitToShell();
- break;
- } // switch
- } // ErrMsgCode
-
-
- // ----------------------------------------------------------------------------------
- // ErrMsg
- // ----------------------------------------------------------------------------------
- // Displays the error alert without a code.
-
- void ErrMsg(Str255 msg)
-
- {
- ErrMsgCode(msg, 0);
-
- } // ErrMsg
-
-